from Katna.video import Video
from Katna.writer import KeyFrameDiskWriter
import os

def extract_key_frames(video_file_path):
    # initialize video module
    vd = Video()

    # number of images to be returned
    no_of_frames_to_returned = 12

    # initialize diskwriter to save data at desired location
    diskwriter = KeyFrameDiskWriter(location="./image")

    # Video file path
    

    print(f"Input video file path = {video_file_path}")

    # extract keyframes and process data with diskwriter
    vd.extract_video_keyframes(
       no_of_frames=no_of_frames_to_returned, file_path=video_file_path,
       writer=diskwriter
    )


# For windows, the below if condition is must.
if __name__ == "__main__":
    video_file_path = os.path.join(".", "video", "test002.mp4")
    extract_key_frames(video_file_path)
  